/**
 *	@file	alf_gimmick.c
 *	@brief	アルフの遺跡　マップギミック用関数群(常駐)
 *	@author	Miyuki Iwasawa
 */
#include "common.h"

#include "fieldsys.h"

#include "field_subproc.h"
#include "field/field.h"
#include "field/situation_local.h"
#include "field/script.h"
#include "field/syswork.h"
#include "field/fld_bgm.h"
#include "fieldmap.h"
#include "zonedata.h"

#include "fielddata/maptable/zone_id.h"
#include "alf_gimmick.h"

#define KAKUSHIBEYA_ACTION_PX	(6)
#define KAKUSHIBEYA_ACTION_PY	(3)
#define KAKUSHIBEYA_ACTION_DIR	(DIR_UP)

/**
 *	@brief	D24R0202 あなぬけの紐　使用チェック
 */
BOOL AlfGimmick_D24R0202AnanukeCheck(FIELDSYS_WORK* fsys)
{
	SITUATION * sit = SaveData_GetSituation(fsys->savedata);
	LOCATION_WORK * now = Situation_GetNowLocation(sit);

	OS_Printf("AnanukeCheck zone=%d,(%d,%d,%d)\n",
			now->zone_id,now->grid_x,now->grid_z,now->dir);
	if(now->zone_id != ZONE_ID_D24R0202){
		return FALSE;
	}
	if(	now->grid_x != KAKUSHIBEYA_ACTION_PX ||
		now->grid_z != KAKUSHIBEYA_ACTION_PY ||
		now->dir != KAKUSHIBEYA_ACTION_DIR){
		return FALSE;
	}
	return TRUE;
}

/**
 *	@brief	D24R0204 フラッシュ　使用チェック
 */
BOOL AlfGimmick_D24R0204FlashCheck(FIELDSYS_WORK* fsys)
{
	SITUATION * sit = SaveData_GetSituation(fsys->savedata);
	LOCATION_WORK * now = Situation_GetNowLocation(sit);

	if(now->zone_id != ZONE_ID_D24R0204){
		return FALSE;
	}
	if(	now->grid_x != KAKUSHIBEYA_ACTION_PX ||
		now->grid_z != KAKUSHIBEYA_ACTION_PY ||
		now->dir != KAKUSHIBEYA_ACTION_DIR){
		return FALSE;
	}
	return TRUE;
}

/**
 *	@brief	D24R0206 水の石　使用チェック
 */
BOOL AlfGimmick_D24R0206MizunoisiCheck(FIELDSYS_WORK* fsys)
{
	SITUATION * sit = SaveData_GetSituation(fsys->savedata);
	LOCATION_WORK * now = Situation_GetNowLocation(sit);

	if(now->zone_id != ZONE_ID_D24R0206){
		return FALSE;
	}
	if(	now->grid_x != KAKUSHIBEYA_ACTION_PX ||
		now->grid_z != KAKUSHIBEYA_ACTION_PY ||
		now->dir != KAKUSHIBEYA_ACTION_DIR){
		return FALSE;
	}
	return TRUE;
}